package com.example.zero.Fragment;

import android.os.Bundle;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.example.zero.Adapter.FragmentAdapter;
import com.example.zero.R;
import com.example.zero.Utils.TimeCount;
import com.hjq.bar.TitleBar;

import java.util.ArrayList;
import java.util.List;


public class SubFragment extends Fragment {

    private View view;

    private ViewPager viewPager;
    private List<Fragment> fragmentList;
    private FragmentAdapter fragmentAdapter;
    private UserSubFragment userSubFragment;


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        view = inflater.inflate(R.layout.fragment_sub, container, false);
        initView();
        fragmentChange();
        TimeCount.getInstance().setTime(System.currentTimeMillis());
        return view;
    }

    private void initView() {
        viewPager = view.findViewById(R.id.view_pager_sub);

    }

    private void fragmentChange() {
        fragmentList = new ArrayList<>();
        userSubFragment = new UserSubFragment();
        fragmentList.add(userSubFragment);
        fragmentAdapter = new FragmentAdapter(getActivity().getSupportFragmentManager(), fragmentList, null);
        viewPager.setAdapter(fragmentAdapter);
    }


}
